<?php

require ('../../classes/GalleryManager.class.php');

$gm = new GalleryManager();
if($_GET['action'] == 'list') {
    echo json_encode($gm->get_folders());
} else if ($_GET['action'] == 'check') {
    echo json_encode(array('count' => $gm->check_folder($_POST['name'])));
} else if ($_GET['action'] == 'save') {
    echo json_encode(array('count' => $gm->save_folder($_POST['name'], $_POST['description'], ($_POST['superfolder'] == 'root') ? null : $_POST['superfolder'])));
}

?>
